#pragma once

#include <engine.core/PropertyTree.hpp>
#include <engine.core/Logger.hpp>

#include "Reader.hpp"
#include "System.hpp"




class DatabaseInfoReader : public DatabaseReader
{
private:

	LoggerPtr           m_logger;
	ItemFactory         m_itemFactory;
	DatabaseSystemPtr   m_database;

	std::ifstream       m_file;
	info_reader         m_reader;

public:

	DatabaseInfoReader(const QString& fname, const ItemFactory& itemFactory, const LoggerPtr& logger, const DatabaseSystemPtr& database);



	/**
	 * This function simply reads the next item from the info document and
	 * returns an empty DatabaseItemPtr, in case the document doesn't contain
	 * any more items.
	 */
	LOOSE_PTR(DatabaseItem) read();



	/**
	 * That is a simply factory function that creates a new DatabasXmlReader.
	 * It's used by the DatabaseSystem to create instance of this reader.
	 */
	static DatabaseReaderPtr create(const QString& fname, const ItemFactory& itemFactory, const LoggerPtr& logger, const DatabaseSystemPtr& database);
};
///////////////////////////////////////////////////////////////////////////////////////////////////
